package com.maxdu.labs.stt.models;

import java.io.Serializable;
import java.util.Date;

import android.util.Log;

import com.maxdu.labs.stt.constants.Constants;
import com.maxdu.labs.stt.models.db.UserDBHelper;

public class User implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String userId;
	private Date creationDate;
	private Date lastLoginDate;
	private Date updateDate;
	private String name;
	
	//TODO deal with the updateDate VS lastLoginDate
	
	public User(String userId, String name, Date creationDate, Date updateDate){
		this.userId = userId;
		this.creationDate = creationDate;
		this.lastLoginDate = creationDate;
	}
	
	public User(String userId, String name){
		this.userId = userId;
		this.name = name;
	}

	public User updateToCloud(){
		
		Log.d(Constants.LOG_TAG, "User.updateToCloud:: START");
		
		UserDBHelper userDBHelper = new UserDBHelper();
		userDBHelper.updateToCloud(this);
		
		return this;
	}
	
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public Date getLastLoginDate() {
		return lastLoginDate;
	}

	public void setLastLoginDate(Date lastLoginDate) {
		this.lastLoginDate = lastLoginDate;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}
}
